package com.ash.proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

public class Main {

    public static void main(String[] args) {
        IHelloService instance = (IHelloService) Proxy.newProxyInstance(IHelloService.class.getClassLoader(), new Class[]{IHelloService.class}, new InvocationHandler() {
            @Override
            public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
                System.out.println(method.getDeclaredAnnotations()[0]);
                System.out.println("hello proxy");
                return args[0];
            }
        });

        System.out.println(instance.say("zjh"));
    }
}
